<?php
/**
 *+------------------
 * Lflow
 *+------------------
 * Copyright (c) 2023~2030 gitee.com/liu_guan_qing All rights reserved.本版权不可删除，侵权必究
 *+------------------
 * Author: Mr.April(405784684@qq.com)
 *+------------------
 */
declare (strict_types=1);

namespace lflow\parser\ipml;

use lflow\model\CustomModel;
use lflow\model\NodeModel;
use lflow\parser\AbstractNodeParser;
use lflow\parser\NodeParser;

/**
 * 自定义节点解析器
 *
 * @author Mr.April
 * @since  1.0
 */
class CustomParser extends AbstractNodeParser
{

    protected function parseNode(NodeModel $model, ?object $nodes): void
    {
        $model->setClazz($nodes->{NodeParser::ATTR_CLAZZ} ?? '');
        $model->setMethodName($nodes->{NodeParser::ATTR_METHODNAME} ?? '');
        $model->setArgs($nodes->{NodeParser::ATTR_ARGS} ?? '');
        $model->setVar($nodes->{NodeParser::ATTR_ARGS} ?? '');
    }

    protected function newModel(): NodeModel
    {
        return new CustomModel();
    }

}
